#ifndef WATERTILE_H
#define WATERTILE_H

#include <QtGui>
#include <sstream>
#include <string>


using namespace std;

// ancestor of all watertiles
class WaterTile
{
    int row,col;
    int id;
    string image, type;
    bool selected;
    QString typeShip;
    bool hit;

    static int nextId;
public:
    WaterTile(int initRow, int initCol, string initType, string initImg):
        row(initRow), col(initCol), type(initType), image(initImg) {
        id = ++nextId;
    }

    virtual string toString() {
//        stringstream sstrm;
//        sstrm << type << "\n" << col << "\n" << row << "\n" << image << "\n" << selected << "\n" << typeShip << "\n" << hit << "\n";
//        return sstrm.str();
        stringstream sstrm;
        sstrm  << type << "\n" << col << "\n" << row << "\n" << image << "\n" << selected <<
                 "\n" << typeShip.toStdString() <<
                  "\n" << hit << "\n";
        return sstrm.str();
    }

    //accessors

    int getRow() { return row; }
    int getCol() { return col; }
    string getImage() { return image; }
    string getType() { return type; }
    bool isSelected() { return selected; }
    int getId() { return id; }
    bool isHit() {return hit;}
    QString getTypeShip() { return typeShip; }

    void setImage(const string& newImg) { image = newImg; }
    void setType(const string& newType) { type = newType; }
    void setSelected(bool newselection) { selected = newselection; }
    void setId(const int initId) {id = initId;}
    void setHit(bool newHit) {hit = newHit;}
    void setTypeShip(QString newType) { typeShip = newType; }
};

// a watertile that has been fired upon
/*class hitWaterTile : public WaterTile {
    string toString() {
        return WaterTile::toString() + " (Has been hit)";
    }
};

// a watertile that has a ship hidden underneath it
class shipWaterTile : public WaterTile {
    string toString() {
        return WaterTile::toString() + " (Has a ship underneath)";
    }
};

// a watertile that has a ship that has been hit
class shipHitWaterTile : public WaterTile {
    string toString() {
        return WaterTile::toString() + " (Ship has been hit)";
    }
};*/

#endif // WATERTILE_H
